import HttpKit from '@/utils/http-kit'

export default {
  /**
   * 功能描述：查询数据字典
   * @param form
   */
  page (form) {
    return HttpKit.post(`/common/data-dict/page`, {
      data: form
    }).then(
      res => res.data
    )
  },
  /**
   * 功能描述：根据[字典标识]查询所以下级
   * @param dataDictId
   */
  findDataDictById (dataDictId) {
    return HttpKit.get(`/common/data-dict/${dataDictId}/children`).then(
      res => res.data
    )
  },
  /**
   * 功能描述：根据[字典唯一标识]查询所以下级
   * @param dictKey
   */
  findDataDictByDictKey (dictKey) {
    return HttpKit.get(`/common/data-dict/dict-key/${dictKey}`).then(
      res => res.data
    )
  },
  /**
   * 功能描述：新增/更新词典
   * @param form
   */
  saveOrUpdate (form) {
    return HttpKit.post(`/common/data-dict`, {
      data: form
    }).then(
      res => res.data
    )
  },
  /**
   * 功能描述：根据Id删除词典
   * @param dataDictId
   */
  deleteDataDictPoint (dataDictId) {
    return HttpKit.delete(`/common/data-dict/${dataDictId}`).then(
      res => res.body
    )
  }
}
